public class Test {
    public static void main(String[] args) {
        //求两个整数的最大值
        int a = 10;
        int b = 20;
        int max = a > b ? a : b;
//        a > b ? a : b; //err
        System.out.println(max); //20

//        System.out.println(b >> 1); //-5


//        System.out.println(a ^ b);
//        int b = 20;

       /* System.out.print(~a); //-11
        System.out.printf("%d\n",~b); //19*/

       /* System.out.println(a | b); //结果为30

        System.out.println(a & b); //结果为0*/

       /* System.out.println(a > b & a / 0 == 0); //编译失败
        System.out.println(a < b | a / 0 == 0); //编译失败*/

/*
        System.out.println(a > b && a / 0 == 0); //false
        System.out.println(a < b || a / 0 == 0); //true
*/

        /*System.out.println(!(a == 10)); //a == 10为true，取非就是false
        System.out.println(!(a != 10)); //a != 10为false，取非就是true*/


        /*System.out.println(a == 10 || b == 20); //左为真，右为真，结果为真，true
        System.out.println(a == 10 || b > 20); //左为真，右为假，结果为真，true
        System.out.println(a < 10 || b == 20); //左为假，右为真，结果为真，true
        System.out.println(a < 10 || b > 20); //左为假，右为假，结果为假，false*/

        /*System.out.println(a == 10 && b == 20); //左为真，右为真，结果为真，true
        System.out.println(a == 10 && b > 20); //左为真，右为假，结果为假，false
        System.out.println(a < 10 && b == 20); //左为假，右为真，结果为假，false
        System.out.println(a < 10 && b > 20); //左为假，右为假，结果为假，false*/


       /* System.out.println(a == b); //false
        System.out.println(a != b); //true
        System.out.println(a < b); //true
        System.out.println(a > b); //false
        System.out.println(a <= b); //true
        System.out.println(a >= b); //false*/

    }
    public static void main2(String[] args) {
        int a = 1;

        a++; //后置++，此时a的值为2
        System.out.println(a); //输出2
        int b = a++; //后置++，先将a的值赋值给b，再对a进行+1操作
        System.out.println(b); //输出2
        System.out.println(a); //输出3

        a = 1; //重置变量a，让a = 1

        ++a; //前置++，此时a的值为2
        System.out.println(a); //输出2
        int c = ++a; //前置++，先对a进行+1操作，a = 3，再将a的值赋值给c
        System.out.println(c); //输出3
        System.out.println(a); //输出3


/*        a += 1; //等同于 a = a + 1
        System.out.println(a); //输出2，a = 2
        a -= 1; //等同于 a = a - 1
        System.out.println(a); //输出1，a = 1
        a *= 6; //等同于 a = a * 6
        System.out.println(a); //输出6，a = 6
        a /= 3; //等同于 a = a / 3
        System.out.println(a); //输出2, a = 2
        a %= 2; //等同于 a = a % 2
        System.out.println(a); //输出0，a = 0*/
    }
    public static void main1(String[] args) {
        System.out.println(1 + 0.2); //1.2

        System.out.println(5.0F % 2);

        int a = 20;
        int b = 10;

        double c = b * 1.0 / a; //0.5
        System.out.println(c);

        System.out.println(a + b); //30
        System.out.println(a - b); //10
        System.out.println(a * b); //200
        System.out.println(a / b); //2
        System.out.println(a % b); //0

    }
}
